package com.wasion.pwportable.protocol.analyzer.indicator;

import com.wasion.pwportable.protocol.analyzer.AbstractAnalyzer;

/**
 * 
 * @ClassName: Current_RD_Analyzer
 * @Description: 3F. 实时电流数据信息
 * @author 高意
 * @date 2014-9-10 下午5:17:12
 * 
 */
public class Current_RD_Analyzer extends AbstractAnalyzer {

	@Override
	public void dataAnalysis(String ackBS) {

		String dataLength = ackBS.substring(DATALENGTHSTARTBIT,
				DATALENGTHSTARTBIT + 2);

		if (dataLength.equalsIgnoreCase("0D")) {

			String laoddata = ackBS.substring(DATABITSTART, DATABITSTART + 4);

			double load = getCurrentInverted(laoddata);
			result.setLineLoad(load);

			String sampleData = ackBS.substring(DATABITSTART + 4,
					DATABITSTART + 8);

			String sample = sampleData.substring(2, 4)
					+ sampleData.substring(0, 2);
			result.setSample(Integer.parseInt(sample, 16));
		}
	}
}
